import { getAvatar } from '@/api/task/taskDetail';
import { getAppId } from '@/utils/local'; // getAppId()

export const getUserAvatar = ({ avatarId = '', avatar = '', userId }, flag) => {
  const app_Id = flag ? undefined : getAppId();
  return getAvatar({ avatarId: avatar, avatar: avatarId, app_Id, userId }).then(res => {
    let result = '';
    if (res.success) {
      result = `data:image/png;base64,${res.data}`;
    }

    return Promise.resolve(result);
  });
};
